package com.dkt.android.mvp.model


/**
 * @author: dtb
 * @email: wendaoyuqin1@gmail.com
 * @createTime: 19-3-12下午8:33
 */

class UserInfo {
    var token: String? = null
    var openid: String? = null
    var nickname: String? = null
    var sex: String? = null
    var headimgurl: String? = null
    var id: String? = null
    var name: String? = null
    var mobile: String? = null

    var alias: String? = null
        get() = field ?: ""

    var head: String? = null

    var authCode: String? = null
    var memberId: String? = null
    var pwd: String? = null
    var unionid: String? = null

    var idType: String? = null
    var wechatId: String? = null
    var role: String? = null

    var videoCount: Int = 0

    var isNewRecord: Boolean = false
    var enable: Boolean = false
    var nonExpire: Boolean = false
    var nonLock: Boolean = false

    fun getHintMobile(): String {
        val m = mobile ?: return ""
        return if (m.length == 11) {
            "${m.substring(0, 3)}****${m.substring(7)}"
        } else {
            ""
        }
    }

    override fun toString(): String {
        return "UserInfo(token=$token, id=$id, name=$name, mobile=$mobile, alias=$alias, head=$head, authCode=$authCode, memberId=$memberId, pwd=$pwd, unionid=$unionid, idType=$idType, wechatId=$wechatId, role=$role, videoCount=$videoCount, isNewRecord=$isNewRecord, enable=$enable, nonExpire=$nonExpire, nonLock=$nonLock)"
    }
}